package com.forenow.demo.demo22;

public class Stringdemo {
    /**
     * 字符串String以及常用的方法
     *
     */
    public static void main(String[] args) {
        String s="tom";
        String new_s=s.concat(" hello world");
        System.out.println(new_s);
        String new_s1=new_s.substring(0,5);  //  下标0-4
        System.out.println(new_s1);

        String reg="aa bb cc";
        String[] result=reg.split(" ");  //拆分
        for (int i = 0; i <result.length ; i++) {
            System.out.println(result[i]);
        }

        String s1="this is java";
        String s2=s1.toUpperCase();  //转大写
        System.out.println(s2);

        String s3="   hello  world  ";
        System.out.println(s3.trim());
    }
}
